varying vec2 vUv;

uniform vec3 uColor;
uniform float uTime;
uniform float uSpeed;
uniform sampler2D uTexture1;
uniform sampler2D uTexture2;
uniform sampler2D uTexture3;

mat2 rotate(float angle) {  
    float c = cos(radians(angle));  
    float s = sin(radians(angle));  
    return mat2(c, -s, s, c);
}


void main(){
    vec2 newUv = vUv - vec2(0.5);
    vec2 transUv1 = rotate(uTime * uSpeed * 6.0) * newUv;
    vec2 transUv2 = rotate(- uTime * uSpeed * 10.0) * newUv;
    vec2 transUv3 = rotate(uTime * uSpeed * 6.0) * newUv;
    vec4 texture1 = texture2D(uTexture1, transUv1 + vec2(0.5));
    vec4 texture2 = texture2D(uTexture2, transUv2 + vec2(0.5));
    vec4 texture3 = texture2D(uTexture3, transUv3 + vec2(0.5));
    gl_FragColor = vec4(uColor, (texture1.r + texture2.r + texture3.r));
    // gl_FragColor = vec4((texture1.rgb + texture2.rgb + texture3.rgb) * uColor, 1.0);
}